Population class extension: cache module

File containing the class extension for the population object that contains cache functionality

Module containing (e.g. LRU) cache functionality for binary_c-python.

We use cachetools when possible because this allows us to set up the cache of the appropriate size for the task in the population_options dict. Please see the LRU_* options in there.

class binarycpython.utils.population_extensions.cache.cache(**kwargs)[source]

Bases: object

Class extension for the population object that contains cache functionality

class NullCache(*args, **kwargs)[source]

Bases: Cache

A cachetools cache object that does as little as possible and never matches.

__delitem__(key)[source]

deleter function placeholder

__getitem__(key)[source]

getter function placeholder

__setitem__(key, value)[source]

Setter function placeholder

popitem()[source]

pop function placeholder

default_cache_dir()[source]

Return a default cache directory path for binary_c-python, or None if we cannot find one. This is used in population_options_defaults.py

setup_function_cache(vb=False, cachetype=None)[source]

Function to wrap binary_c-python’s functions in function cache.

The functions listed in self.population_options[‘function_cache_functions’] are given caches of size self.population_options[‘function_cache_size’][func]

Args: None

test_caches(dt=5.0)[source]

Function to test cache speeds of the functions that binary_c-python automatically caches.

Parameters

dt (default 5) –